#include "operation.h"

namespace MISystem
{
	StockOperation::StockOperation()
		: _operationId(0), _quantity(0)
	{}

	StockOperation::StockOperation(
		int id,
		const QString& materialId,
		OpType type,
		int quantity,
		const QString& operatorName,
		const QDateTime& opTime)
		: _operationId(id)
		, _materialId(materialId)
		, _operationType(type)
		, _quantity(quantity)
		, _operator(operatorName)
		, _operationTime(opTime)
	{}

	int StockOperation::getOperationId() const
	{
		return _operationId;
	}

	QString StockOperation::getMaterialId() const
	{
		return _materialId;
	}

	StockOperation::OpType StockOperation::getOperationType() const
	{
		return _operationType;
	}

	int StockOperation::getQuantity() const
	{
		return _quantity;
	}

	QString StockOperation::getOperator() const
	{
		return _operator;
	}

	QDateTime StockOperation::getOperationTime() const
	{
		return _operationTime;
	}

	QString StockOperation::getOperationTypeString() const
	{
		return _operationType == In ? "IN" : "OUT";
	}

	void StockOperation::setOperationType(OpType type)
	{
		_operationType = type;
	}

	void StockOperation::setQuantity(int quantity)
	{
		_quantity = quantity;
	}

	void StockOperation::setOperator(const QString& operatorName)
	{
		_operator = operatorName;
	}
}